<!-- 子组件 孙子组件 -->
<template>
    <h1> {{ msg }} 说：hello </h1>
    <button @click="change">改变</button>
</template>

<script setup lang="ts">
    import { ref,Ref, reactive, onMounted,useAttrs, inject } from "vue";

    // const attrs = useAttrs()
    let msg = inject('msgToChild')
    function change() {
        (msg as unknown as Ref<string>).value = Math.random().toString()
    }

</script>
<style scoped>
</style>